'''
Created on 2020年3月3日

@author: Administrator
'''

class BaseView():
    def __init__(self):
        pass
#     
#     def upload(self, request):
#         if request.method == 'POST' and 'file' in request.files:
#             file= request.files['file']
#             file_split = file.filename.split(".")
#             ext = file_split[len(file_split) - 1].lower()
#             if ext not in ["png", "jpg", "gif"]:
#                 return jsonify({"code": -1, "msg": "图片只能是png,jpeg,jpg格式"})
# #                 fn = time.strftime('%Y%m%d%H%M%S')+ '%d' % random.randint(0, 1000)+ "."+ext
#             file.save(os.path.join(configconfigD_PATH, "temp"))
#             image = open(os.path.join(configconfigD_PATH, "temp"), 'rb') 
# #                 path = "./upload/images/" + fn
# #             image = open("D:/phpstudy_pro/WWW/essc/service/upload/images/20200309022734240.jpg", 'rb') 
#             base64_data = base64.b64encode(image.read())
#         return base64_data
    
    def resultSet(self,code, message, data, total=0):
        if message == "":
            if len(data) > 0:
                message = "数据取得成功"
            else:
                message = "没有符合条件的数据"

        return {"code":code, "message":message,"data":data,"total":total}
    
    def resultSummary(self,code, message, data):
        if message == "":
            if len(data) > 0:
                message = "数据取得成功"
            else:
                message = "没有符合条件的数据"
    
        return {"code":code, "message":message,"data":data}